home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / ncsat.cpt / Telnet2.5 final / vr / vr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-23  |  3.5 KB  |  154 lines

  1. /*
  2. ** @(#)vr.h    1.2    (NCSA)    9/27/87
  3. */
  4.  
  5. extern int VRdestroy
  6.   (
  7.     union arg av[]
  8.   );
  9.  
  10. extern int VRinit
  11.   (
  12.     void
  13.   );
  14.  
  15. extern int VRwrite
  16.   (
  17.     char *b,
  18.     int len
  19.   );
  20.  
  21.  
  22.  
  23. #ifdef RASTER_MASTER
  24.  
  25. /*
  26. ** defines for raster states and variables
  27. */
  28.  
  29. /*
  30. ** states
  31. */
  32.  
  33. #define    DONE        0        /* we've been called */
  34. #define    ESCFOUND    1        /* found escape */
  35. #define    WANTCMD        2        /* want a command char */
  36. #define    WANTDEL        3        /* want that first delimiter */
  37. #define    IARG        4        /* looking for integer arg */
  38. #define    SARG        5        /* looking for string arg */
  39. #define    CARG        6        /* looking for count arg */
  40. #define    DATA        7        /* all args parsed, found ^ */
  41.  
  42. /*
  43. ** commands
  44. */
  45.  
  46. #define ESC        0x1b            /* start of a sequence */
  47. #define    ESCCMD    ' '                /* escape to next level of commands */
  48. #define    DELIM    ';'                /* argument delimiter */
  49. #define    CMDTRM    '^'                /* terminator, but also prefix w/ ESC */
  50. #define    WINCMD    'W'                /* create a window */
  51. #define    DESCMD    'D'                /* destroy a window */
  52. #define    MAPCMD    'M'                /* change color map entries */
  53. #define    RLECMD    'R'                /* run-length encoded data */
  54. #define    PIXCMD    'P'                /* standard pixel data */
  55. #define IMPCMD  'I'             /* IMCOMP compressed data */
  56. #define    FILCMD    'F'                /* save to file command */
  57. #define    CLKCMD    'C'                /* click the slide camera */
  58. #define    SAVCMD    'S'                /* save a color map to a file */
  59.  
  60. /*
  61. ** command parameter types
  62. */
  63.  
  64. #define    MAXARGS    7                /* maximum args to a command */
  65. #define INT        1                /* integer argument */
  66. #define    STRING    2                /* string (character) argument */
  67. #define    COUNT    3                /* data count argument */
  68. #define LINEMAX 1024            /* longest width for window */
  69.  
  70. /*
  71. ** virtual-level functions -- each one will call a similarly named
  72. ** function prefixed with RR, e.g VRwindow becomes RRwindow
  73. */
  74.  
  75. extern int VRwindow(), VRmap(), VRfile(), VRpixel();
  76. extern int VRrle(), VRimp(), VRmsave(), VRclick();
  77.  
  78. /*
  79. ** flag values
  80. */
  81.  
  82. #define FL_NORMAL    1        /* command needs no data */
  83. #define    FL_DATA        2        /* command takes data */
  84.  
  85. /*
  86. ** structure of command table
  87. */
  88.  
  89. struct cmd {
  90.     char    c_name;
  91.     int        c_flags;
  92.     int        (*c_func)();
  93.     int        c_args[MAXARGS];
  94. };
  95.  
  96. struct cmd cmdtab[] = {
  97.     WINCMD, FL_NORMAL, VRwindow, {INT, INT, INT, INT, INT, STRING, 0},
  98.     DESCMD, FL_NORMAL, VRdestroy, {STRING, 0, 0, 0, 0, 0, 0},
  99.     MAPCMD, FL_DATA, VRmap, {INT, INT, COUNT, STRING, 0, 0, 0},
  100.     FILCMD, FL_NORMAL, VRfile, {INT, INT, INT, INT, INT, STRING, STRING},
  101.     PIXCMD, FL_DATA, VRpixel, {INT, INT, INT, COUNT, STRING, 0, 0},
  102.     RLECMD, FL_DATA, VRrle, {INT, INT, INT, COUNT, STRING, 0, 0},
  103.     IMPCMD, FL_DATA, VRimp, {INT, INT, INT, COUNT, STRING, 0, 0},
  104.     CLKCMD, FL_NORMAL, VRclick, {STRING, 0, 0, 0, 0, 0, 0},
  105.     SAVCMD, FL_NORMAL, VRmsave, {STRING, STRING, 0, 0, 0, 0, 0}
  106. };
  107.  
  108. #define NCMDS    (sizeof(cmdtab) / sizeof(struct cmd))
  109.  
  110. #endif RASTER_MASTER
  111.  
  112. /*
  113. ** everything after here is safe to be included by client
  114. ** ie, low-level routines
  115. */
  116.  
  117. /*
  118. ** saved arg values in parser
  119. */
  120.  
  121. union arg {
  122.     int        a_num;                /* integer number */
  123.     char    a_ptr[100];            /* string pointer */
  124. };
  125.  
  126. typedef    struct VRwin VRW;
  127. typedef    struct RRwin RRW;
  128.  
  129. /*
  130. ** format of a window entry
  131. */
  132.  
  133. struct VRwin {
  134.     char    w_name[100];        /* window's name, assigned on creation */
  135.     char    w_used;                /* flag - is this name an old duplicate? */
  136.     int        w_left;                /* left edge */
  137.     int        w_top;                /* top edge */
  138.     int        w_width;            /* width */
  139.     int        w_height;            /* height */
  140.     int        w_display;            /* hardware display number of window */
  141.     RRW        w_rr;                /* machine dep info for window */
  142.     VRW        *w_next;            /* next pointer */
  143. };
  144.  
  145. /*
  146. ** variables for linked list management
  147. */
  148.  
  149. #ifdef MASTERDEF
  150. struct VRwin VRhead;
  151. #else
  152. extern struct VRwin VRhead;
  153. #endif
  154.